<?php
error_reporting(E_ALL|E_STRICT);

set_include_path(
	'C:/xampplite/htdocs/administration/library' . PATH_SEPARATOR . 
	get_include_path()
	);
include "Zend/Loader.php";
include "LayoutPlugin.php";//render header and footer
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_Registry');
Zend_Loader::loadClass('Zend_View');
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Db_Table');
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Session_Namespace');
Zend_Loader::loadClass('Zend_Layout');
// load configuration
$config = new Zend_Config_Ini('./application/config.ini', 'general');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);

//setup layout
$layoutConfig = new Zend_Config_Ini('./application/config.ini', 'layout');
//$layout = new Zend_Layout($layoutConfig);//won't work
$layout = Zend_Layout::startMvc($layoutConfig);
//var_dump($layout);
$idSession = new Zend_Session_Namespace('Admin_Namespace');
Zend_Registry::set('admin_session', $idSession);
//$idSession->_userName = null;

// setup database
$db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);
//$pathconfig = $config->sitePath;
//echo $pathconfig;
// setup controller
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('./application/controllers');


// run!
$frontController->dispatch();
